// File:    TnHemFactory.cs
// Author:  HT
// Created: Thursday, October 27, 2011 1:08:21 PM
// Purpose: Definition of Class TnHemFactory

using System;
using System.Windows.Forms;
using ESRI.ArcGIS.Geodatabase;

namespace Tayninh2011
{
    public class TnHemFactory
    {
        ITnToolsWorkspace toolWsp = new TnTools();
        ITnExToolsDataManager exToolManager = new TnExToolsDataManager();
        ITnExToolsSpatial exToolSpatial = new TnExToolsSpatial();
        
        public TnHem GetHem(EnumLoaiHem loaihem, IWorkspaceEdit wsp, string env, string[,] userInfo)
        {
            string path="";
            switch (loaihem)
            {
                case EnumLoaiHem.hemDuongPho:
                    return new TnHem(toolWsp.OpenFeatureClassFromSDE(wsp, "tn_hem"));
                case EnumLoaiHem.hemBuffer1m:
                    //if(!exToolManager.TnCheckLayerExist(userInfo,"tn_hem_buff_1"))
                    //{
                    //    MessageBox.Show("ok");
                    string fcBuff=exToolSpatial.TnBuffer(TnFeatureClassName.HEM, TnFeatureClassName.HEM_BUFFER_1M, 1,out path, env, wsp);
                    //} 
                    return new TnHem(toolWsp.OpenFeatureClassFromFileMdb(path,fcBuff));
                default: return null;
            }
        }

    }
}
